<template>
  <div class="box">
      <header class="header">
          <router-link tag="div" to="/menu_classification" class="iconfont icon-fenlei1"></router-link>
          <router-link tag="div" to="/search" class="iconfont icon-sousuo1"> 菜谱、用户等</router-link>
          <router-link tag="div" to="/message" class="iconfont icon-lingdangcopy"></router-link>
      </header>
      <div class="content">
        <!-- <template>
          <div class="block">
            <el-carousel height="150px">
              <el-carousel-item v-for="item of bannerlist" :key="item.id">
                <h3><img :src="item.greurl" alt=""></h3>
              </el-carousel-item>
            </el-carousel>
            
          </div>
        </template> -->
        <mt-swipe :auto="4000">
          <mt-swipe-item v-for = "(item, index) of 3" :key ="index">
            <img src="./../../assets/food.jpg" alt="">
          </mt-swipe-item>
        </mt-swipe>
        <!-- <Prolist :prolist = 'prolist'/> -->
        <ul class="kinds">
          <router-link tag="li" to="/menu_classification" class="iconfont icon-caidan-copy"><span>菜谱分类</span></router-link>
          <router-link tag="li" to="/weekgood" class="iconfont icon-fenlei1"><span>本周佳作</span></router-link>
          <router-link tag="li" to="/sign_in" class="iconfont icon-ai-hongbao"><span>签到领现金</span></router-link>
          <li @click="goSearchList($event)" class="iconfont icon-jiankang1"><span>食疗养生</span></li>
          <li @click="goSearchList($event)" class="iconfont icon-iconhongbei10"><span>烘焙</span></li>
          <li @click="goSearchList($event)" class="iconfont icon-baotang1"><span>煲汤</span></li>
          <li @click="goSearchList($event)" class="iconfont icon-caipin_sushi"><span>素食主义</span></li>
          <li @click="goSearchList($event)" class="iconfont icon-jiankang"><span>母婴专区</span>
          </li>
        </ul>
        <!-- <div class="videoList" v-for="(item, index) of allgreenlist" :key="index">
          <h1>精彩短视频</h1>
          <div class="video">
            <p class="dishName">{{ item.grename }}</p>
            <div class="detail">
              <span class="userName">{{ item.username }}</span>
              <div class="right">
                <p class="skim iconfont icon-yanjing"><span>skim</span></p>
                <p class="collection iconfont icon-xingxing"><span>collection</span></p>
              </div>
            </div>
            <video controls src="item.greurl"></video>
          </div>
        </div> -->
        <div class="hotList">
          <h1>热门推荐</h1>
          <div class="video" @click="goDetail(item)" v-for="item of 4" :key="item.id">
            <p class="dishName">糖醋里脊</p>
            <div class="detail">
              <span class="userName">一米阳光</span>
              <div class="right">
                <p class="skim iconfont icon-yanjing"><span>4848</span></p>
                <p class="collection iconfont icon-xingxing"><span>2454</span></p>
              </div>
            </div>
            <img src="./../../assets/food2.jpg" />
          </div>
        </div>
      </div>
  </div>
</template>

<script>
// import Prolist from '@/components/Prolist'
import Vue from 'vue'
import { Swipe, SwipeItem } from 'mint-ui'
// import api from '@/api'
import axios from 'axios'
Vue.use(Swipe, SwipeItem)
export default {
  data () {
    return {
      bannerlist: [],
      allgreenlist: [],
      val: ''
    }
  },
  created () {
    // axios.all([this.getBannerList(), this.getAllGreenList ()])
    //   .then(axios.spread((bannerData, allgreenData) => {
    //     // console.log(allgreenData.data.data)
    //     let arr = []
    //     bannerData.data.map(item1 => {
    //       arr.push(item1)
    //     })
    //     this.bannerlist = arr
    //     let arr2 = []
    //     allgreenData.data.data.map(item2 => {
    //       arr2.push(item2)
    //     })
    //     this.allgreenlist = allgreenData.data.data
    //     // console.log(arr2)
    //   }))
  },
  methods: {
    getBannerList () {
      return axios.get('/daxun/banner')
    },
    getAllGreenList () {
      // return axios.get('http://10.8.162.81:8082/greens/getAllGreens')
    },
    goDetail (item) {
      this.$router.push(`/fooddetail?id=${item.id}`)
    },
    goSearchList (e) {
      var dom =e.target
      console.log(dom.innerText)
      this.val = dom.innerText
      sessionStorage.setItem('search', this.val)
      this.$router.push(`/searchlist2?typename=${this.val}`)
    }
  }
}
</script>

<style lang="scss" scoped>
@import '@/lib/reset.scss';
.header {
  @include flexbox();
  align-items: center;
  justify-content: space-between;
  padding: 0 0.1rem;
  border-bottom: 1px solid #ccc;
  .iconfont {
  }
  .icon-fenlei1 {
    @include font-size(0.20rem);
  }
  .icon-sousuo1 {
    background: #F7F7F7;
    padding: 5px 10px;
    width: 80%;
    border-radius: 5px;
    color: #CCCCCC;
    @include font-size(0.15rem);
  }
  .icon-lingdangcopy {
    @include font-size(0.20rem);
  }
}
.content {
  width: 90%!important;
  margin: 0 auto;
  .mint-swipe {
    width: 100%;
    height: 160px;
    margin-top: 10px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .kinds {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    // flex: 1;
    .iconfont {
      font-size: 22px;
      color: #f66;
    }
    li {
      width: 24%;
      height: 60px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      margin-top: 10px;
      span {
        font-size: 12px;
        color: rgb(82, 80, 80);
      }
    }
  }
  .videoList {
    margin-top: 10px;
    h1 {
      margin: 10px 0;
      font-size: 18px;
    }
    .video {
      margin-bottom: 20px;
      width: 100%;
      .dishName {
        font-size: 16px;
        font-weight: 600;
      }
      .detail {
        margin-bottom: 5px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        .userName {
          color: #9394AF;
        }
        .right {
          color: #9393B0;
          display: flex;
          p {
            font-size: 12px;
            margin-left: 15px;
            span {
              margin-left: 5px;
            }
          }
          .skim {
          }
          .collection {
          }
        }
      }
      video {
        width: 100%;
        border-radius: 3px;
      }
    }
  }
  .hotList {
    h1 {
      margin: 10px 0;
      font-size: 18px;
    }
    .video {
      margin-bottom: 20px;
      width: 100%;
      .dishName {
        font-size: 14px;
        font-weight: 500;
      }
      .detail {
        margin-bottom: 5px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        .userName {
          color: #9394AF;
        }
        .right {
          color: #9393B0;
          display: flex;
          p {
            font-size: 12px;
            margin-left: 15px;
            span {
              margin-left: 5px;
            }
          }
          .skim {
          }
          .collection {
          }
        }
      }
      img {
        width: 100%;
        height: 211px;
        border-radius: 3px;
      }
    }
  }
}
.el-carousel__item img {
  opacity: 0.75;
  line-height: 150px;
  margin-top: 10px;
  width: 100%;
  height: auto;;
}
</style>
